<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>更新信息</title>
    <script th:src="@{/js/jquery.js}"></script>
    <script th:src="@{/js/layui.js}"></script>
    <link rel="stylesheet" type="text/css" th:href="@{/css/layui.css}">
    <script type="text/javascript">
        function check(){
            if ([[${session.user.is_cold}]] == 1){
                alert("您的账号已冻结！无法进行此操作。");
                return false;
            }
            var password = document.getElementsByName("password")[0].value;
            var password2 = document.getElementsByName("password2")[0].value;
            var tel = document.getElementsByName("tel")[0].value;

            if (password != password2){
                alert("密码不一致");
                return false;
            }
            if (tel.length!=11 && tel.length!=0){
                alert("请输入正确的电话");
                return false;
            }
            return true;
        }
    </script>
    <style>
        form{
            margin-top: 50px;
            padding: 50px;
        }
    </style>
</head>
<body>
<form class="layui-form" onsubmit="return check()" th:action="@{/update}" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="text" maxlength="20" name="password" placeholder="6-20个字符，空白默认不修改" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">重复密码</label>
        <div class="layui-input-block">
            <input type="text" maxlength="20" name="password2" placeholder="重复密码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">电话</label>
        <div class="layui-input-block">
            <input type="text" maxlength="11" oninput = "value=value.replace(/[^0-9.]/g,'')" name="tel" placeholder="空白默认不修改" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
    <div class="layui-bg-gray">
        <p style="font-size: 30px" th:text="${updatemsg}"></p>
    </div>
</form>
</body>
</html>